package LeetCode_100;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2022/10/26 21:27
 * 判断两个树是否为镜像树
 */
public class SolutionIsMirror {
    public boolean isMirror(TreeNode p,TreeNode q){
        if(p==null && q==null){
            return true;
        }
        if (p==null || q ==null){
            return false;
        }
        return p.val==q.val
                &&isMirror(p.left,q.right)
                &&isMirror(p.right,q.left);
    }
}
